package com.proton.carepatchtemp.listener;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

import com.proton.carepatchtemp.utils.net.XMPPCenter;

/**
 * Created by MoonlightSW on 2017/1/15.
 */

public class NetChangeReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo activeInfo = manager.getActiveNetworkInfo();
        if (null != activeInfo) {
            XMPPCenter.loginChat();
        }
    }
}
